package com.apes.framework.plugin.mq.domain;

import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.util.DateUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Column;

@Data
@Document(collection = "MQueue")
public class MQueue {

    @Id  // 主键
    private String id; //消息编号
    private String topic; //消息主题
    private String description; //主题描述
    private String body; //消息
    private int state = 0;//0:未消费；1：报错；2：已消费
    private String error = "";//错误消息
    private String created = DateUtil.format();  //消息创建时间
    private String ended = DateUtil.format();  //消息最后消费时间
    private int times = 0; //消费次数
    private String tags;
    private Integer handled = 0; //遗漏消息处理标记：0-未处理；1-已处理

    public void incTimes() {
        this.times += 1;
    }
}
